package mlc.om.upgrade.cargo;

import java.util.Hashtable;

import mlc.om.upgrade.Upgrade;
import mlc.ore.Ore;

public class Cargo extends Upgrade implements CargoInterface {

	double volumeCapacity;
	Hashtable<Ore, Integer> ores;

	public Cargo(double volumeCapacity, int price, String name,
			String description) {
		super(price, name, description, "Cargo Bay");
		ores = new Hashtable<Ore, Integer>();
		this.volumeCapacity = volumeCapacity;
	}

	private double getOccupiedVolume() {
		double volumeOccupied = 0;
		for (Ore ore : ores.keySet())
			volumeOccupied += ore.getVolume() * getOres().get(ore).intValue();
		return volumeOccupied;
	}

	public double getLoadPercentage() {
		return getOccupiedVolume() / getVolumeCapacity();
	}

	public Hashtable<Ore, Integer> getOres() {
		return this.ores;
	}

	public double getVolumeCapacity() {
		return volumeCapacity;
	}
}
